import 'package:flutter/material.dart';
import 'package:x_common_utils/utils/inkWell_util.dart';
import 'package:xinxuan/utils/color_util.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class InfoItem extends StatelessWidget {

  final String title;
  final Widget child;
  final Function onTap;
  final bool showRigth;
  final bool showBorder;

  InfoItem({
    required this.title,
    required this.child, 
    required this.onTap,
    this.showRigth = true, 
    this.showBorder = true
  });

  @override
  Widget build(BuildContext context) {
    return InkWellUtil.shakeProofInkWell(Container(
      padding: EdgeInsets.symmetric(horizontal: 12.w),
      color: bgWhiteColor,
      child: Container(
        padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 4.w),
        decoration: BoxDecoration(
          border: Border(
            bottom: showBorder ? BorderSide(
              color: lineColor1,
              width: 1.w
            ) : BorderSide.none
          )
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(
              title,
              style: TextStyle(
                color: textBlackColor,
                fontSize: 16.sp
              ),
            ),
            Row(
              children: [
                child,
                showRigth ? Container(
                  margin: EdgeInsets.only(left: 10.w),
                  child: Image.asset(
                    'assets/icons/icon_arrow_right.png',
                    width: 16.w,
                    height: 16.w,
                  ),
                ) : Container()
              ],
            )
          ],
        ),
      ),
    ), () => onTap());
  }
}